<template>
	<view class="content">
		<scroll-view scroll-x class="bg-white nav text-center header">
			<view class="cu-item" :class="index==TabCur?'text-cyan cur':''" v-for="(item,index) in navs" :key="index" @tap="tabSelect" :data-id="index">
				{{item}}
			</view>
		</scroll-view>
		<view class="cons" v-if="TabCur == 0">
			<view class="consa bg-white" v-for="(item, index) in orderlist" :key="index">
				<view class="list list_tit flexs1">
					<view class="text-gray small">下单时间：{{item.createtime}}</view>
					<view class="list_stus text-bold" v-if="item.status==1">待付款</view>
					<view class="list_stus text-bold" v-if="item.status==2">已付款</view>
					<view class="list_stus text-bold" v-if="item.status==3">上门取衣</view>
					<view class="list_stus text-bold" v-if="item.status==4">智能洗护</view>
					<view class="list_stus text-bold" v-if="item.status==5">上门送回</view>
				</view>
				<view class="list flexs1">
					<view class="text-gray">取件时间</view>
					<view class="list_left">{{item.take_day}} {{item.take_times}}</view>
				</view>
				<view class="list flexs1">
					<view class="text-gray">取件地址</view>
					<view class="list_left">{{item.address_address}}</view>
				</view>
				<view class="list flexs1">
					<view class="text-gray">取件人信息</view>
					<view class="list_left">{{item.address_name}} <text class="text-gray">{{item.address_mobile}}</text></view>
				</view>
			</view>
		</view>
		<view class="cons" v-if="TabCur == 1">
			<view class="consa bg-white" v-for="(item, index) in completelist" :key="index">
				<view class="list list_tit flexs1">
					<view class="text-gray small">下单时间：{{item.createtime}}</view>
					<view class="list_stus text-bold">已完成</view>
				</view>
				<view class="list flexs1">
					<view class="text-gray">取件时间</view>
					<view class="list_left">{{item.take_day}} {{item.take_times}}</view>
				</view>
				<view class="list flexs1">
					<view class="text-gray">取件地址</view>
					<view class="list_left">{{item.address_address}}</view>
				</view>
				<view class="list flexs1">
					<view class="text-gray">取件人信息</view>
					<view class="list_left">{{item.address_name}} <text class="text-gray">{{item.address_mobile}}</text></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				TabCur: 0,
				scrollLeft: 0,
				navs:['未完成','已完成'],
				orderlist:[],
				completelist:[]
			}
		},
		onShow() {
			this.initdata();
		},
		methods: {
			initdata(){
				var obj={
					status:'1,2,3,4,5'
				}
				this.$common.requests('/api/order/orderlist',obj).then(res =>{
					if(res.data.code == 1){
						this.orderlist = res.data.data;
					}else{
						this.$api.msg(res.data.msg)
					}
				})
				var obj={
					status:'6'
				}
				this.$common.requests('/api/order/orderlist',obj).then(res =>{
					if(res.data.code == 1){
						this.completelist = res.data.data;
					}else{
						this.$api.msg(res.data.msg)
					}
				})
			},
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
			}
		}
	}
</script>

<style>
	.content{
		width: 100%;
		height: 100vh;
		background: #F9F9F9;
		font-size: 30upx;
	}
	.header{
		border-top: 1px solid #E6E6E6;
		position: fixed;
		width: 100%;
		top: 0;
		left: 0;
	}
	.cu-item{
		padding: 0!important;
		margin: 0 80upx!important;
	}
	.cons{
		position: fixed;
		top: 95upx;
		left: 0;
		width: 100%;
		padding: 20upx;
		height: 83%;
		overflow-y: scroll;
	}
	.consa{
		border-radius: 20upx;
		padding: 0 20upx;
	}
	.list{
		padding: 20upx 0;
		align-items: flex-start;
		margin-bottom: 20upx;
	}
	.list_tit{
		border-bottom: 1px solid #E6E6E6;
	}
	.list_stus{
		color: #FDB212;
	}
	.small{
		font-size: 26upx;
	}
	.list_left{
		font-size: 28upx;
		width: 70%;
		text-align: right;
	}
</style>
